{% extends 'reports.html' %}

{% block header %}Reports: Library status{% endblock %}

{% block report %}
<form action="." method="POST">
    {% include "reports/custom_day_controls.html" %}

    <div class="itemsWrapper reportItems">
            <table>
              <thead>
                <tr>
                    <th rowspan='2'>Title
                      <br>
                      <input type="image" name="btn_sort_title" src="/media/images/sort-desc.gif" height="17" width="17" alt="Ascending" title="Ascending">
                      <input type="image" name="btn_sort_-title" src="/media/images/sort-asc.gif" height="17" width="17" alt="Descending" title="Descending">
                      <!-- <input type="submit" name="btn_sort_title" value="^" title="Ascending"/> -->
                      <!-- <input type="submit" name="btn_sort_-title" value="v" title="Descending"/> -->
                    </th>
                    <th rowspan='2'>Location
                      <br>
                      <input type="image" name="btn_sort_location" src="/media/images/sort-desc.gif" height="17" width="17" alt="Ascending" title="Ascending">
                      <input type="image" name="btn_sort_-location" src="/media/images/sort-asc.gif" height="17" width="17" alt="Descending" title="Descending">
                      <!-- <input type="submit" name="btn_sort_location" value="^" title="Ascending"/> -->
                      <!-- <input type="submit" name="btn_sort_-location" value="v" title="Descending"/> -->
                      </th>
                    <th rowspan='2'>Shelf mark
                      <br>
                      <input type="image" name="btn_sort_shelf_mark" src="/media/images/sort-desc.gif" height="17" width="17" alt="Ascending" title="Ascending">
                      <input type="image" name="btn_sort_-shelf_mark" src="/media/images/sort-asc.gif" height="17" width="17" alt="Descending" title="Descending">
                      <!-- <input type="submit" name="btn_sort_shelf_mark" value="^" title="Ascending"/> -->
                      <!-- <input type="submit" name="btn_sort_-shelf_mark" value="v" title="Descending"/> -->
                      </th>
                    <th rowspan='2'>Status
                      <br>
                      <input type="image" name="btn_sort_status" src="/media/images/sort-desc.gif" height="17" width="17" alt="Ascending" title="Ascending">
                      <input type="image" name="btn_sort_-status" src="/media/images/sort-asc.gif" height="17" width="17" alt="Descending" title="Descending">
                      <!-- <input type="submit" name="btn_sort_status" value="^" title="Ascending"/> -->
                      <!-- <input type="submit" name="btn_sort_-status" value="v" title="Descending"/> -->
                      </th>
                    <th colspan='3'>Last time rented</th>
                </tr>
                <tr>
                    <th>For whom
                      <br>
                      <input type="image" name="btn_sort_for_whom" src="/media/images/sort-desc.gif" height="17" width="17" alt="Ascending" title="Ascending">
                      <input type="image" name="btn_sort_-for_whom" src="/media/images/sort-asc.gif" height="17" width="17" alt="Descending" title="Descending">
                      <!-- <input type="submit" name="btn_sort_for_whom" value="^" title="Ascending"/> -->
                      <!-- <input type="submit" name="btn_sort_-for_whom" value="v" title="Descending"/> -->
                    </th>
                    <th><span title="When rental stated">When</span>
                      <br>
                      <input type="image" name="btn_sort_when" src="/media/images/sort-desc.gif" height="17" width="17" alt="Ascending" title="Ascending">
                      <input type="image" name="btn_sort_-when" src="/media/images/sort-asc.gif" height="17" width="17" alt="Descending" title="Descending">
                      <!-- <input type="submit" name="btn_sort_when" value="^" title="Ascending"/> -->
                      <!-- <input type="submit" name="btn_sort_-when" value="v" title="Descending"/> -->
                    </th>
                    <th>Librarian
                      <br>
                      <input type="image" name="btn_sort_librarian" src="/media/images/sort-desc.gif" height="17" width="17" alt="Ascending" title="Ascending">
                      <input type="image" name="btn_sort_-librarian" src="/media/images/sort-asc.gif" height="17" width="17" alt="Descending" title="Descending">
                      <!-- <input type="submit" name="btn_sort_librarian" value="^" title="Ascending"/> -->
                      <!-- <input type="submit" name="btn_sort_-librarian" value="v" title="Descending"/> -->
                    </th>
                </tr>
              </thead>
              <tbody>
                {% for book in report %}
                <tr>
                    <td><a href="{% url book_one book.copy.book.id %}">{{ book.title }}</a></td>
                    <td><a href="{% url location_one book.copy.location.id %}">{{ book.location }}</a></td>
                    <td><a href="{% url copy_one book.copy.id %}">{{ book.shelf_mark }}</a></td>
                    <td>{{ book.status }}</td>
                    {% if book.not_rented_yet %}
                        <td colspan='3'>- never -</td>
                    {% else %}
                        <td><a href="{% url user_one book.for_whom.id %}">{{ book.for_whom }}</a></td>
                        <td>{{ book.when }}</td>
                        <td><a href="{% url user_one book.by_whom.id %}">{{ book.by_whom }}</a></td>
                    {% endif %}
                </tr>
                {% endfor %}
              </tbody>
            </table>
    </div>
</form>
{% endblock %}
